package com.gg.registration.model.cmn;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

/**
 * <p>
 * Dict
 * </p>
 *
 * @author qy
 */
@Data
@TableName("dict")
public class Dict {

    private static final long serialVersionUID = 1L;

    private Long id;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("create_time")
    private Date createTime;

    @TableField("update_time")
    private Date updateTime;

    @TableLogic
    @TableField("is_deleted")
    private Integer isDeleted;

    @TableField(exist = false)
    private Map<String,Object> param = new HashMap<>();

    @TableField("parent_id")
    private Long parentId;

    @TableField("name")
    private String name;

    @TableField("value")
    private String value;

    /**
     *
     */
    @TableField("dict_code")
    private String dictCode;

    @TableField(exist = false)
    private boolean hasChildren;

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public Integer getIsDeleted() {
        return isDeleted;
    }

    public void setIsDeleted(Integer isDeleted) {
        this.isDeleted = isDeleted;
    }

    public Map<String, Object> getParam() {
        return param;
    }

    public void setParam(Map<String, Object> param) {
        this.param = param;
    }

    public Long getParentId() {
        return parentId;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getDictCode() {
        return dictCode;
    }

    public void setDictCode(String dictCode) {
        this.dictCode = dictCode;
    }

    public boolean isHasChildren() {
        return hasChildren;
    }

    public void setHasChildren(boolean hasChildren) {
        this.hasChildren = hasChildren;
    }

    public Dict() {
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Dict dict = (Dict) o;
        return hasChildren == dict.hasChildren &&
                Objects.equals(id, dict.id) &&
                Objects.equals(createTime, dict.createTime) &&
                Objects.equals(updateTime, dict.updateTime) &&
                Objects.equals(isDeleted, dict.isDeleted) &&
                Objects.equals(param, dict.param) &&
                Objects.equals(parentId, dict.parentId) &&
                Objects.equals(name, dict.name) &&
                Objects.equals(value, dict.value) &&
                Objects.equals(dictCode, dict.dictCode);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, createTime, updateTime, isDeleted, param, parentId, name, value, dictCode, hasChildren);
    }

    @Override
    public String toString() {
        return "Dict{" +
                "id=" + id +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                ", isDeleted=" + isDeleted +
                ", param=" + param +
                ", parentId=" + parentId +
                ", name='" + name + '\'' +
                ", value='" + value + '\'' +
                ", dictCode='" + dictCode + '\'' +
                ", hasChildren=" + hasChildren +
                '}';
    }


}